<?php

class Article extends CI_Controller{
    public function __construct() {
        parent::__construct();
        $this->load->helper("url");
	$this->load->library('my_layout');
	$this->my_layout->setLayout("layout/frontend");
        $this->load->model('article_model');
    }
    function index() {
        /*$data['article'] = $this->article_model->get_all()->result_array();
        
        $this->load->model('type_center_model');
        $data['type_center'] = $this->type_center_model->get_all()->result_array();
        print_r($data);*/
        $this->my_layout->view('frontend/news',$data = '');
    }
    function loadByType($id_type) {
        
        $data['article'] = $this->article_model->get_by_type($id_type)->result_array();
        
        $this->load->model('type_center_model');
        $data['type_center'] = $this->type_center_model->get_all()->result_array();
        
        $data['id_type_center'] = $id_type;
        print_r($data);
        
        //$this->my_layout->view('frontend/news',$data);
    }
    function loadById($id) {
        $data['article'] = $this->article_model->get_by_id($id)->row_array();
        
        $this->load->model('type_center_model');
        $data['type_center'] = $this->type_center_model->get_all()->result_array();
        
        $data['id_article'] = $id;
        print_r($data);
        
        //$this->my_layout->view('frontend/new',$data);
    }
    
}